#！/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time     :2019/1/13 17:17
# @Author   :Yosef-夜雨声烦
# E-mail    :wurz529@foxmail.com
# File      :myjson.py
# Software  :PyCharm Community Edition
import json


class MyJson:

    def to_json(self, obj):
        res = json.dumps(obj, indent=4, sort_keys=True, separators=(',', ': '))
        return res

    def to_python(self, obj):
        res = json.loads(obj, encoding="utf-8")
        return res


if __name__ == '__main__':
    A = MyJson()
    data = {'a': 'Runoob', 'b': 7}
    res = A.to_json(data)
    print(res)
    res = A.to_python(res)
    print(res)


